package com.dyz.leetcode._07_hashSearch;

import java.util.HashMap;
import java.util.Map;

public class _136_singleNumber {
    public int singleNumber(int[] nums) {
        HashMap<Integer, Integer> hashMap = new HashMap<>();
        for(int num:nums){
            hashMap.put(num, hashMap.getOrDefault(num, 0)+1);
        }
        for(Map.Entry<Integer, Integer> entry:hashMap.entrySet()){
            if(entry.getValue()==1){return entry.getKey();}
        }
        return -1;
    }
}
